{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Highcharts Demos\n",
    "================\n",
    "Box plot: http://www.highcharts.com/demo/box-plot\n",
    "-------------------------------------------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe style=\"border:0;outline:none;overflow:hidden\" srcdoc=\"&lt;!DOCTYPE html&gt;\n",
       "&lt;html lang=&quot;en&quot;&gt;\n",
       "    &lt;head&gt;\n",
       "        &lt;meta charset=&quot;utf-8&quot; /&gt;\n",
       "        &lt;link href=&quot;https://www.highcharts.com/highslide/highslide.css&quot; rel=&quot;stylesheet&quot; /&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts-more.js&quot;&gt;&lt;/script&gt;\n",
       "        &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/exporting.js&quot;&gt;&lt;/script&gt;\n",
       "    &lt;/head&gt;\n",
       "    &lt;body style=&quot;margin:0;padding:0&quot;&gt;\n",
       "                &lt;div id=&quot;container&quot; style=&quot;width:550px;height:400px;&quot;&gt;Loading....&lt;/div&gt;\n",
       "\n",
       "\n",
       "    &lt;script&gt;\n",
       "        $(function(){\n",
       "\n",
       "\n",
       " \n",
       "\n",
       "\n",
       "\n",
       "\n",
       "            Highcharts.setOptions({&quot;lang&quot;: {}, &quot;global&quot;: {}});\n",
       "            var option = {&quot;loading&quot;: {}, &quot;subtitle&quot;: {}, &quot;xAxis&quot;: {&quot;categories&quot;: [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;], &quot;title&quot;: {&quot;text&quot;: &quot;Experiment No.&quot;}}, &quot;title&quot;: {&quot;text&quot;: &quot;Highcharts Box Plot Example&quot;}, &quot;series&quot;: {}, &quot;labels&quot;: {}, &quot;yAxis&quot;: {&quot;plotLines&quot;: [{&quot;color&quot;: &quot;red&quot;, &quot;width&quot;: 1, &quot;value&quot;: 932, &quot;label&quot;: {&quot;text&quot;: &quot;Theoretical mean: 932&quot;, &quot;align&quot;: &quot;center&quot;, &quot;style&quot;: {&quot;color&quot;: &quot;gray&quot;}}}], &quot;title&quot;: {&quot;text&quot;: &quot;Observations&quot;}}, &quot;chart&quot;: {&quot;width&quot;: 550, &quot;renderTo&quot;: &quot;container&quot;, &quot;type&quot;: &quot;boxplot&quot;, &quot;height&quot;: 400}, &quot;tooltip&quot;: {}, &quot;plotOptions&quot;: {}, &quot;credits&quot;: {&quot;enabled&quot;: false}, &quot;colors&quot;: {}, &quot;pane&quot;: {}, &quot;exporting&quot;: {}, &quot;drilldown&quot;: {}, &quot;navigation&quot;: {}, &quot;legend&quot;: {&quot;enabled&quot;: false}};\n",
       "\n",
       "\n",
       "            var data = [{&quot;data&quot;: [[760, 801, 848, 895, 965], [733, 853, 939, 980, 1080], [714, 762, 817, 870, 918], [724, 802, 806, 871, 950], [834, 836, 864, 882, 910]], &quot;type&quot;: &quot;boxplot&quot;, &quot;name&quot;: &quot;Observations&quot;, &quot;tooltip&quot;: {&quot;headerFormat&quot;: &quot;&lt;em&gt;Experiment No {point.key}&lt;/em&gt;&lt;br/&gt;&quot;}}, {&quot;name&quot;: &quot;Outlier&quot;, &quot;marker&quot;: {&quot;lineWidth&quot;: 1, &quot;fillColor&quot;: &quot;white&quot;, &quot;lineColor&quot;: Highcharts.getOptions().colors[0]}, &quot;type&quot;: &quot;scatter&quot;, &quot;data&quot;: [[0, 644], [4, 718], [4, 951], [4, 969]], &quot;tooltip&quot;: {&quot;pointFormat&quot;: &quot;Observation: {point.y}&quot;}}]\n",
       "            option.series = data;\n",
       "\n",
       " \n",
       "\n",
       "            var chart = new Highcharts.Chart(option);\n",
       "\n",
       "\n",
       "\n",
       "\n",
       "\n",
       " \n",
       "\n",
       "\n",
       "        \n",
       "    });\n",
       "        &lt;/script&gt;\n",
       "\n",
       "    &lt;/body&gt;\n",
       "&lt;/html&gt;\" height=400 width=550></iframe>"
      ],
      "text/plain": [
       "<highcharts.highcharts.highcharts.Highchart at 0x7fd6ac0c7dd0>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from highcharts import Highchart\n",
    "H = Highchart(width=550, height=400)\n",
    "\n",
    "options = {\n",
    "    'chart': {\n",
    "        'type': 'boxplot'\n",
    "    },\n",
    "    'title': {\n",
    "        'text': 'Highcharts Box Plot Example'\n",
    "    },\n",
    "    'legend': {\n",
    "        'enabled': False\n",
    "    },\n",
    "    'xAxis': {\n",
    "        'categories': ['1', '2', '3', '4', '5'],\n",
    "        'title': {\n",
    "            'text': 'Experiment No.'\n",
    "        }\n",
    "    },\n",
    "\n",
    "    'yAxis': {\n",
    "        'title': {\n",
    "            'text': 'Observations'\n",
    "        },\n",
    "        'plotLines': [{\n",
    "            'value': 932,\n",
    "            'color': 'red',\n",
    "            'width': 1,\n",
    "            'label': {\n",
    "                'text': 'Theoretical mean: 932',\n",
    "                'align': 'center',\n",
    "                'style': {\n",
    "                    'color': 'gray'\n",
    "                }\n",
    "            }\n",
    "        }]\n",
    "    },\n",
    "}\n",
    "\n",
    "data =[\n",
    "    [760, 801, 848, 895, 965],\n",
    "    [733, 853, 939, 980, 1080],\n",
    "    [714, 762, 817, 870, 918],\n",
    "    [724, 802, 806, 871, 950],\n",
    "    [834, 836, 864, 882, 910]\n",
    "]\n",
    "data_outline = [[0, 644],\n",
    "                [4, 718],\n",
    "                [4, 951],\n",
    "                [4, 969]]\n",
    "\n",
    "H.set_dict_options(options)\n",
    "H.add_data_set(data, 'boxplot', 'Observations', tooltip = {\n",
    "                'headerFormat': '<em>Experiment No {point.key}</em><br/>'})\n",
    "H.add_data_set(data_outline, 'scatter', 'Outlier', marker = {\n",
    "                'fillColor': 'white',\n",
    "                'lineWidth': 1,\n",
    "                'lineColor': 'Highcharts.getOptions().colors[0]'\n",
    "            },\n",
    "            tooltip = {\n",
    "                'pointFormat': 'Observation: {point.y}'\n",
    "            })\n",
    "\n",
    "H"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
